package com.aigc.sclassroom.controller;

import com.aigc.sclassroom.pojo.Result;
import com.aigc.sclassroom.pojo.Survey;
import com.aigc.sclassroom.service.SurveyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/survey")
public class SurveyController {
    @Autowired
    private SurveyService surveyService;


    //在本节课添加问卷
    @PostMapping
    public Result add(@RequestParam String surveyName, @RequestParam Long classId){
        surveyService.add(surveyName,classId);
        return Result.success();
    }

    //获取本节课的问卷
    @GetMapping
    public Result<List<Survey>> list(@RequestParam Long classId){
        List<Survey> ss=surveyService.list(classId);
        System.out.println(ss);
        return Result.success(ss);
    }
}